<template>
  <div class="home">
    <div class="content">
      <p @click="serch">请搜索您想要的歌曲</p>
      <input type="text" @keyup.enter="serch" name="" id="ipt" v-model="value" placeholder="请输入音乐" />
    </div>
  </div>
</template>

<script>
// import local from '@/utils/local.js'
export default {
  data() {
    return {
      value: ''
    }
  },
  methods: {
    async serch() {
      // 判断是否为空
      if (this.value.trim()) {
        // 不为空
        this.$router.push({ path: '/list', query: { name: this.value.trim() } })
      }
    }
  }
}
</script>

<style scoped>
.home {
  height: 100%;
  background-color: rgb(245, 245, 245);
  display: flex;
  justify-content: center;
  align-items: center;
}
.content {
  color: rgb(204, 204, 204);
  font-size: 30px;
  width: 300px;
  height: 100px;
}
input {
  text-indent: 15px;
  border: none;
  outline: none;
  width: 260px;
  height: 30px;
}
</style>
